<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="../angular-1.5.8/angular.js"></script>
    <script src="../jquery-3.1.0.js"></script>
    <style>
        #box{
            width: 200px;
            height: 200px;
            border:1px solid red
        }
    
    </style>
</head>
<body>
    <div ng-app="mainApp">
        <div  ng-controller="one" >
            <div id="box" ng-mouseover="over()" ng-mouseleave="out()" ng-style="bk"></div>
        </div>
    </div>
</body>
<script>
// 使用DOM来获取的元素
    // angular.module("mainApp",[])
    //         .controller("one",function ($scope){
    //             var div = document.getElementById("#box");
    //              $scope.over = function () {
    //             box.style.backgroundColor = 'blue';
    //             };
    //              $scope.out = function () {
    //                  box.style.backgroundColor = '';
    //             };
    //         })
    //如果要用DOm操作可以使用NG内置的DOM
    // angular.module("mainApp",[])
    //        .controller( 'one', function ( $scope ) {
    //         $scope.over = function () {
    //             $( 'div' ).css( 'backgroundColor', 'blue' );
    //         };
    //         $scope.out = function () {
    //             $( 'div' ).css( 'backgroundColor', '' );
    //         };
    //     });



    angular.module("mainApp",[])
            .controller("one",function ($scope){
                $scope.bk={
                    width:'200px',
                    height:'200px',
                    border:"1px solid blue"
                }
                $scope.over=function ( ){
                    $scope.bk.backgroundColor="red";
                }
                $scope.out=function (){
                    $scope.bk.backgroundColor="";
                }

            })
</script>
</html>